package com.huatai.datadevelop.thread.service;

import com.alibaba.fastjson.JSON;
import com.huatai.datadevelop.utils.RedisCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author hecai
 * @description: TODO 异步线程将数据写入到redis中
 * @date 2022/12/13 10:07
 * @Version 1.0
 */
@Slf4j
@Service
public class AsyncServiceExecut {


    /**
     * 数据存储到redis
     * @param object
     * @param redisKey
     */
    @Async("asyncServiceExecutor")
    public void executorService(Object object, String redisKey, RedisCache redisCache){
        redisCache.set(redisKey, JSON.toJSONString(object),-1L);
    }
}
